package com.cherrish.demo.consumer.rest;

import com.alibaba.dubbo.config.annotation.Reference;
import com.cherrish.demo.dubbo.service.IHelloService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author cherrish
 * @time 2019-04-25 16:03
 * @name TestController
 * @desc:
 */
@RestController
public class TestController {
    @Reference(url = "dubbo://127.0.0.1:20880")
    private IHelloService iHelloService;

    @GetMapping(value = "/hello")
    public String hello(String name){
        long start = System.currentTimeMillis();
        String result = iHelloService.hello(name);

        return result + " ["+ (System.currentTimeMillis() - start) +"]";
    }
}
